Skip to content

On Event

Plugin: Logic | Mode: Listen

Waits for the occurrence of a specified event and switches to a next state when the specified event occurs.

In addition, it is possible to query the content (payload or message) of an event for a condition and to switch to a next state only if the condition is true.

For example, react to events that were triggered with Dispatch Event.

Also Devices trigger events when the device sends a message to adaptor:ex.

On Event waits for events until one of the events occurs (and any condition matches) or the state is changed due to another action or a manual operation.

Like all listener actions, On Event will only terminate on a state change within the same path. See Paths to find out more about the behavior of paths and their effects on listener actions like On Event.

In the chapter about Events you will learn more about how to use events in your levels.

Under Conditions you learn how to query or compare variables in the On Event and other actions.

Settings

from

The session, game or item whose events are to be listened to.

Set from to "game" to listen to global, level-spanning, game events that you triggered with Dispatch Event.

Set from to "session" or omit it altogether to listen to local events within the current session of your level that you triggered with Dispatch Event.

Some plugin items can trigger events. Set a reference to a plugin item for from to listen for events from that plugin item.

You can also trigger events from data items. Set a reference to a data item for from to listen for events from the respective data item.

event

The name of the event that is being waited for.

if

optional

Check the payload of the event for one or more if conditions. If a condition is met, it will switch to the specified next state.

If the potential event payload contains a JS object you can use field to specify which property in the object you want to check for a condition.

Use dot (.) notation in field to name nested properties in the object.

else

optional

Switch to next state as soon as the specified event arrives, independent of a payload.

Will only be triggered if no if condition applies beforehand.